import socket                                         

serversocket = socket.socket(
	        socket.AF_INET, socket.SOCK_STREAM) 
#host = socket.gethostname() #本机地址                          
host='172.16.39.86';
port = 8087                                           
serversocket.bind((host, port))
serversocket.listen(5)                                           
print("我在 ", host, " 等你...")
clientsocket,addr = serversocket.accept()   

print("已跟%s连接" % str(addr))

while True:
	msg=input("->");	
	clientsocket.send(msg.encode('gb2312'))
	if(msg=="88"):
		break;
	msg=clientsocket.recv(1024)
	print(msg.decode('gb2312'))
	if(msg.decode('gb2312')=="88"):
		break;
clientsocket.close()